#pragma once

#include <singleton.h>

const char PA_MODELS[] = "models";
const char PA_MESHES[] = "meshes";
const char PA_TEXTURES[] = "textures";
const char PA_MATERIALS[] = "materials";
const char PA_ANIMS[] = "anims";
const char PA_MAPS[] = "maps";

typedef std::list<std::string> string_list;

class file_system : public singleton<file_system>
{
public:
	file_system();
	file_system(const std::string &config);
	~file_system();

	std::string parse_disk_letter(const std::string &p) const;
	std::string parse_path(const std::string &path) const;
	std::string parse_filename(const std::string &path) const;
	std::string parse_name(const std::string &path) const;
	std::string parse_suffix(const std::string &path) const;

	void set_path(const char *alias, const std::string &path);
	void set_current_dir(const std::string &dir);

	std::string get_path(const char *alias) const;

	void fix_slashes(std::string &path) const;

	void create_dir(const std::string &path) const;

	void copy_file(const std::string &source, const std::string &target) const;

	bool path_exists(const std::string &p) const;

	std::string get_current_dir() const;

	string_list split_path(const std::string &path) const;

private:
	typedef std::map<std::string, std::string>	alias_map;

	alias_map	m_aliases;
};